package com.studerb.view;

import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;

import org.springframework.beans.factory.annotation.Autowired;

import com.studerb.view.connectionPool.ConnectionPoolPane;
import com.studerb.view.headers.HeadersTabbedPane;
import com.studerb.view.newsGroups.NewsGroupsPane;
import com.studerb.view.server.MasterServerPane;
import com.studerb.view.tasks.TasksPane;

/**
 * Applications Swing main Frame from which the GUI is derived Wired in Spring
 * as mainFrame
 */

public class MainPanel extends JSplitPane {
	protected JTabbedPane topTabbedPane;
	@Autowired protected NewsGroupsPane newsGroupsPane;
	@Autowired protected ConnectionPoolPane connectionPoolPane;
	@Autowired protected TasksPane tasksPane;
	@Autowired protected HeadersTabbedPane headersPane;
	@Autowired protected MasterServerPane masterServerPane;

	public JTabbedPane getTabbedPane() {
		return topTabbedPane;
	}

	public void init() {
		// initStatusBar();
		// initTaskBar();
		setOrientation(JSplitPane.VERTICAL_SPLIT);
		// allow the top tabbed pane to get most of the extra space when
		// resizing
		setResizeWeight(0.7);
		topTabbedPane = new JTabbedPane();
		topTabbedPane.addTab("NewsGroups", newsGroupsPane);
		topTabbedPane.addTab("Master Server", masterServerPane);
		topTabbedPane.addTab("Connections", connectionPoolPane);
		topTabbedPane.addTab("Headers", headersPane);
		setTopComponent(topTabbedPane);
		setBottomComponent(tasksPane);
	}
}
